﻿
namespace Mulala.Cavan.TestAppService.MulalaModule
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using NUnit.Framework;
    using Spring.Context;
    using Spring.Context.Support;
    using Mulala.Cavan.Application.MainBoundedContext.MulalaModule;
    using Mulala.Cavan.Domain.MainBoundedContext.MulalaModule;

    [TestFixture]
    public class TestMulalaRegistrationAppService
    {
        private IApplicationContext context;

        [SetUp]
        public void SetUp()
        {
            context = ContextRegistry.GetContext();
        }

        [Test]
        public void TestAddProprietor()
        {
            IMulalaRegistrationAppService mulalaRegistrationAppService = context.GetObject(MulalaAppServiceConst.MULALAREGISTRATIONAPPSERVICE) as IMulalaRegistrationAppService;
            ProprietorRegistrationResult prr =  mulalaRegistrationAppService.AddProprietor("proprietor2", "123456", "proprietor2@qq.com", "0201");

            Assert.Greater(prr.Object.ID, 0);
        }

        [Test]
        public void TestAddCorporation()
        {
            IMulalaRegistrationAppService mulalaRegistrationAppService = context.GetObject(MulalaAppServiceConst.MULALAREGISTRATIONAPPSERVICE) as IMulalaRegistrationAppService;
            CorporationRegistrationResult crr = mulalaRegistrationAppService.AddCorporation("corporation1", "123123", "corporation1@qq.com", "0201");

            Assert.Greater(crr.Object.ID, 0);
        }

        [Test]
        public void TestAddNanny()
        {
            IMulalaRegistrationAppService mulalaRegistrationAppService = context.GetObject(MulalaAppServiceConst.MULALAREGISTRATIONAPPSERVICE) as IMulalaRegistrationAppService;
            NannyRegistrationResult nrr = mulalaRegistrationAppService.AddNanny("nanny1", "654321", "nanny1@qq.com", "0201");

            Assert.Greater(nrr.Object.ID, 0);
        }
    }
}
